package top.dingwen.io.treasure.api.base.response;

import lombok.Getter;
import lombok.Setter;
import top.dingwen.io.treasure.api.base.constant.ApiConstant;

import java.util.Objects;

/**
 * RestResponse : rest和Json统一响应处理
 *
 * @author dingwen
 * @since 2024/10/22 16:03
 */
@SuppressWarnings(ApiConstant.ALL)
@Setter
@Getter
public class RestResponse implements IBaseResponse {

    /**
     * 执行结果
     */
    private Boolean success;

    /**
     * 业务响应码
     */
    private String code;

    /**
     * 业务响应消息
     */
    private String message;

    /**
     * 成功数据对象
     */
    private Object dataObj;

    /**
     * 失败数据对象
     */
    private Object errorObj;

    @Override
    public Boolean getSuccess() {
        return Objects.nonNull(dataObj);
    }
}
